Associating mac addresses with addresses in a look-up table

ABSTRACT

An ethernet switch associates addresses in a look-up table with received MAC addresses using a CRC algorithm, so that correspondence data about each MAC address can be stored in the corresponding section of the look-up table. When, as the look-up table is constructed, a given MAC address A 0  hashes to an address H 0  which is already associated with a previous MAC address, the MAC address is re-hashed using Walsh codes W 1,m  to provide a different look-up table address H 1 . This procedure can be performed any number of times y to generate different addresses H n  for n=1, . . . y. If it is performed sufficiently frequently, then it is likely that an address will be found which is free. In this way, the number of MAC addresses which will typically be associated with a single look-up table address is reduced, preferably to only one.

FIELD OF THE INVENTION

The present invention relates to methods of associating MAC addresseswith addresses in a look-up table. The invention further relates to aswitch such as an ethernet switch employing the method.

BACKGROUND OF THE INVENTION

Each computer on a LAN (local area network), such as an ethernet LAN,has a unique address called a MAC (media access control) address. AnInternet switch which is connected to various computers of the LANthrough its different respective switch ports, needs to learn the MACaddress associated with each switch port, and may additionally storeother data pertaining to each of these MAC addresses. It does this bydefining a look-up table in RAM, so that each MAC address is associatedwith an address in the look-up table (here referred to as a “look-uptable address”). The look-up table needs to store at each address thecorrespondence data for each MAC address which becomes associated withthat address. This correspondence data includes the MAC address itself,and also data which is to be stored about that MAC address (e.g. theport with which the computer having that MAC address is associated). TheMAC address alone is 48-bits wide, so a large RAM is needed to definethe look-up table.

The association of MAC addresses with addresses in the look-up tableproceeds by an automatic algorithm. Clearly, the RAM cannot be so largeas to have a number of look-up table addresses equal to the total numberof possible MAC addresses (i.e. 2 to the power of 48). Therefore, acorrespondence is defined between MAC addresses and memory location, andfor this a process known as “hashing” is used. “Hashing” refers to theprocess of mapping the 48-bit MAC address to a shorter look-up tableaddress using a compression algorithm, such as a Cyclic Redundancy Code(CRC) algorithm to reduce the 48-bit addresses to X bits, where X is thenumber of bits defining an address in the look-up table. Typically X is9 or 10.

Often more than one of the computers attached to a single switch will bemapped by the hashing to the same look-up table address. Hence, the RAMwill have to have a large enough memory capacity to store, at eachlook-up table address, all the correspondence data which may have to bestored for each of the MAC addresses which might be mapped to thatlook-up table address. In other words, the memory requires a large“width” for each look-up table address. This is despite the fact that,while there may be a few addresses in the look-up table which are mappedto several MACs of the LAN, there will typically be a very large numberof look-up table addresses which are not mapped to any MAC addresses. Inother words, there is an inefficiency. The implication is that there isan unnecessary increase of the memory size. A possible solution to thisproblem is provided by using content-addressable memory, but this isboth costly and complex, so a simpler solution is desirable.

SUMMARY OF THE INVENTION

The present invention seeks to alleviate at least partially the problemsdescribed above.

In general terms, the present invention proposes that when, as thelook-up table is constructed, a given MAC address hashes to a look-uptable address which is already occupied (i.e. there is already a MACaddress associated with that look-up table address), the MAC address isre-hashed to provide a different look-up table address. This procedurecan be performed any number of times. If it is performed sufficientlyfrequently, then it is likely that an address will be found which isfree. In this way, the number of MAC addresses which will typically haveto be associated with a single look-up table address is reduced,preferably to only one.

Specifically, a first expression of the invention is a method ofassociating look-up table addresses with MAC addresses, the methodincluding for successive MAC addresses A₀:

using A₀ to generate y+1 look-up table addresses H₀, H₁, H₂, . . . ,H_(y), where y is an integer greater than or equal to one; and

according to at least one criterion, associating the address A₀ with aselected one of the addresses H₀, H₁, H₂, . . . , H_(y).

The criterion may, for example, be that A₀ is associated with H_(n)where n is the smallest integer in the range 0 to y such that there ispresently no MAC address associated with the address H_(n), or moregenerally such that the number of MAC addresses presently associatedwith the address H_(n) is less than a predetermined integer.

The addresses H₁ to H_(y) are preferably generated successively, upon itbeing determined that the previously generated address fails to meet thecriterion. For example, H_(n+1) may be generated only in the case thatit is found that H_(n) does not meet the criterion.

The value of y may be predetermined, such that the maximum number ofaddresses H₀, H₁, H₂, . . . , H_(y) which are generated is no more thana predetermined integer, even if none of these addresses meets thecriterion. In this case a second criterion may be used to select whichof the addresses H₀, H₁, H₂, . . . , H_(y) is associated with theaddress A₀.

Alternatively, the value of y may be unlimited, and the method maygenerate addresses continually until at least one is found which meetsthe criterion.

Each of the addresses H₁, H₂, . . . , H_(y) is preferably obtained fromthe address A₀ by the following steps. Firstly, we forming a respectivestring S_(n) having the same number of bits as A₀ (according to presenttechnology, 48). These S_(n) may just be respective sections of A₀ andin this case we optionally select one S_(n) (say S₁) and XOR itcomponent-by-component with each of the other y−1 S_(n), so that each ofthe other y−1 S_(n) is modified. Then each S_(n) (or modified S_(n)) ismodulated with a respective set of Walsh codes (of the kind widely usedin CDMA encoding for example). The y resultant strings are used in thesame CRC which transformed A₀ to H₀, to produce H_(n). Due to the use ofWalsh codes, the likelihood is higher of the H_(n) for different MACaddresses A₀ being different from each other.

In a second aspect, the invention provides an Ethernet switch whichperforms a method according to the invention.

Specifically, this aspect of the invention may be expressed as an switchincluding a memory for defining a look-up table having a plurality ofaddresses and a processor for associating MAC addresses with addressesof the look-up table,

the processor being arranged to use each MAC address A₀ to generate y+1look-up table addresses H₀, H₁, H₂, . . . , H_(y) for y an integergreater than or equal to one, and according to at least one criterion toassociate the address A₀ with a selected one of the addresses H₀, H₁,H₂, . . . , H_(y).

Naturally, the various preferred features of the method are alsopreferred features of the switch.

BRIEF DESCRIPTION OF THE FIGURES

An embodiment of the invention will now be described in detail for thesake of example only, with reference to the following figures in which:

FIG. 1 shows schematically the ways the embodiment uses a 48-bit MACaddress to form four different look-up table addresses;

FIG. 2 shows an algorithm for constructing a look-up table in theembodiment; and

FIG. 3 shows an algorithm for retrieving data from a look-up tableformed by the algorithm of FIG. 2.

DETAILED DESCRIPTION OF THE EMBODIMENT

The method used by the embodiment to generate multiple look-up tableaddresses from a single MAC code is illustrated schematically in FIG. 1.The 48-bit MAC address is there called A₀. A₀ can be hashed by a knownCRC to form an address of any desired number of bits (typically 9 or 10bits). The MAC address for A₀ generated in this way is referred to hereas look-up table address H₀.

The embodiment proposes that 3 alternative look-up table addresses maybe created. The first is formed from the first 16 bits of the 48-bit MACaddress, S₁. The second is formed from the second 16 bits of the 48-bitMAC address, S₂. The third is formed from the final 16 bits of the48-bit MAC address, S₃. Generally, these 16-bit strings are referred tohere as S_(n), for integer n=1, . . . , 3. S₂ and S₃ are then preferablymodified by XORing them, component-by-component with S₁.

Each of the 16-bit strings S_(n) is then used to generate acorresponding 48 bit string A_(n), n=1, . . . , 3 byspreading/modulating the corresponding string S_(n) by using arespective code which is formed as a 16-bit concatenation of 3 different16-bit Walsh codes. The nine 16-bit Walsh codes are written W_(n,m) n=1,. . . 3, m=1, . . . 3. The first three 3 components of A_(n) are formedby an XOR of the first component of S_(n) with the first threecomponents of W_(n,1) respectively. Similarly, the second threecomponents of A_(n) are formed by an XOR of the second component ofS_(n) with the second three components of W_(n,1) respectively. And soon. The sixth three components of A_(n) are formed by XORing the sixthcomponent of S_(n) by the last component of W_(n,1) and the first twocomponents of W_(n,2.) And so on.

The same CRC is then used to generate a look-up table address H_(n) foreach of these strings A_(n).

The algorithm by which a new MAC address A₀ is added to the look-uptable is illustrated in FIG. 2, and has the following steps.

In step 1, the address A₀ is received.

In step 2, the address A₀ is hashed by the CRC to form look-up tableaddress H₀, and the integer variable n is set to 0.

In step 3, it is determined if the look-up table address H_(n) isalready occupied. If the answer is “no”, then the MAC address A₀ can beassociated with the address H_(n) and the algorithm terminates.

If the answer at step 3 is “yes”, the algorithm determines in step 4 ifn is less than 3.

If the answer is “yes”, then in step 5 the algorithm increases n by 1,forms H_(n), and then returns to step 3.

If the answer is “no” then the algorithm terminates. No free addresseshave been found at any of H₀, H₁, H₂, or H₃. In this case, the algorithmfinds the one of the addresses out of H₀, H₁, H₂ and H₃ for which theassociation with its MAC address was formed furthest into the past,deletes this association, and associates A₀ with that address. In thisway, as new MAC addresses are received each new address always becomesassociated with a look-up table address which is not presently occupied,but sometimes old MAC addresses lose their association with any entry ofthe look-up table.

FIG. 3 shows an algorithm for extracting information about a certain MACaddress from a look-up table generated by the embodiment.

In a first step 11 a MAC address A₀ is received.

In step 12 the integer variable n is set to 0, and the same CRC is usedto generate a first look-up table address H_(n).

In step 13, it is determined whether the look-up table address H_(n) isassociated with the MAC address A₀ (this can be done by examining thecorrespondence data at address H_(n) in the look-up table). If theanswer is “yes” then the required information is extracted from theaddress H_(n), and the algorithm terminates.

If the answer is “no”, the algorithm proceeds to step 14 in which it isverified whether n is less than 3. If no, then the algorithm has failedto find any look-up table address associated with A₀. In this case, thesystem may proceed in any of the ways which are known in the prior artin comparable circumstances. For example, if information is to betransmitted to a computer with the MAC address A₀, that information maybe multicast (i.e. transmitted through a group of the ports) orbroadcast (i.e. transmitted through all of the ports), in order that itshould reach that computer.

If the answer is “yes” the algorithm proceeds to step 15 in which n isset to n+1, W_(n,1), W_(n,2) and W_(n,3) are used to generate A_(n), andthe CRC is used to generate look-up table address H_(n) from A_(n).After this the algorithm returns to step 13.

Although the invention has been explained above with reference to asingle embodiment. Many variations of this algorithm are possible withinthe scope of the invention as will be clear to a skilled reader.

As a first example, although the algorithm has been shown trying justfour look-up table addresses, this can be generalised to y addresses(i.e. the algorithm above illustrates the special case of y=3). Thereare various ways in which the 48-bit MAC address A₀ can be used togenerate y different addresses H_(n), n=1, . . . , y as will be clear toa skilled reader. The only way in which FIGS. 2 and 3 need be varied inthis case is that the test at steps 4 and 14 becomes whether n is lessthan y.

As a second example, although the use of Walsh codes is preferred thereare many ways in which a 16-bit string S_(n) can be converted into a48-bit string A_(n), and indeed many ways in which strings A_(n) can begenerated without using strings S_(n), as will be clear to a skilledreader.

As a third example, although the invention has been shown in FIG. 2terminating when the number of look-up table addresses found to beoccupied is 3, in principle the algorithm may keep on generating newlook-up table addresses until a certain criterion is fulfilled, e.g.that an unoccupied look-up table address is found with which the presentMAC address can be associated.

1. A method of associating look-up table addresses with media accesscontrol (MAC) addresses, the method including for successive MACaddresses A₀: using A₀ to generate y+1 look-up table addresses H₀, H₁,H₂, . . . , H_(y), where y is an integer greater than or equal to one,wherein each of the addresses H₁, H₂, . . . , H_(y) is obtained from theaddress A₀ by first forming a respective string A₀ having the samenumber of bits as A₀, and then applying the algorithm by which H₀ isobtained from A₀; and according to at least one criterion associatingthe address A₀ with a selected one of the addresses H₀, H₁, H₂, . . . ,H_(y).
 2. A method according to claim 1 wherein the criterion is that A₀is associated with H_(n) where n is the smallest integer in the range 0to y such that there is presently no MAC address associated with theaddress H_(n).
 3. A method according to claim 1 wherein the criterion isthat A₀ is associated with H_(n) where n is the smallest integer in therange 0 to y such that the number of MAC addresses associated with theaddress H_(n) is less than a predetermined integer.
 4. A methodaccording to claim 1 wherein the addresses H₁ to H_(y) are generatedsuccessively upon it being found that the preceding H_(n) does not meeta criterion.
 5. A method according to claim 4 wherein the value of y ispredetermined, whereby the maximum number of addresses H₀, H₁, H₂, . . ., H_(y) which are generated is no more than a predetermined number, evenif none of these addresses meets the criterion.
 6. (canceled)
 7. Amethod according to claim 1 wherein each A_(n) is obtained by modulatinga string S_(n) obtained by a selection from A₀ with a respective set ofWalsh codes.
 8. A switch including a memory for defining a look-up tablehaving a plurality of addresses and a processor for associating MACaddresses with addresses of the look-up table, the processor beingarranged to use each MAC address A₀ to generate y+1 look-up tableaddresses H₀, H₁, H₂, . . . , H_(y) for y an integer greater than orequal to one, wherein each of the addresses H₁, H₂, . . . , H_(y) isobtained from the address A₀ by first forming a respective string Anhaving the same number of bits as A₀, and then applying the algorithm bywhich H₀ is obtained from A₀, and according to at least one criterion toassociate the address A₀ with a selected one of the addresses H₀, H₁,H₂, . . . , H_(y).
 9. A method according to claim 2 wherein theaddresses H₁ to H_(y) are generated successively upon it being foundthat the preceding H_(n) does not meet a criterion.
 10. A methodaccording to claim 8 wherein the addresses H₁ to H_(y) are generatedsuccessively upon it being found that the preceding H_(n) does not meeta criterion.
 11. A method according to claim 3 wherein the addresses H₁to H_(y) are generated successively upon it being found that thepreceding H_(n) does not meet a criterion.
 12. A method according toclaim 10 wherein the addresses H₁ to H_(y) are generated successivelyupon it being found that the preceding H_(n) does not meet a criterion.13. A method of associating look-up table addresses with media accesscontrol (MAC) addresses, the method comprising: receiving a MAC address;generating a first look-up table address based upon the MAC address, thefirst look-up address being generated using an algorithm; determiningwhether the first look-up table address is occupied; and if the firstlook-up table address is occupied, generating a second look-up tableaddress by forming a string having the same number of bits as the MACaddress and applying the algorithm to the string.
 13. The method ofclaim 12 and further comprising: determining whether the second look-uptable address is occupied; and if the second look-up table address isoccupied, generating a third look-up table address by forming a secondstring having the same number of bits as the MAC address and applyingthe algorithm to the string.
 14. The method of claim 13 and furthercomprising: determining whether the third look-up table address isoccupied; and if the third look-up table address is occupied, generatinga fourth look-up table address by forming a third string having the samenumber of bits as the MAC address and applying the algorithm to thestring.
 15. The method of claim 12 wherein determining whether the firstlook-up table address is occupied comprises determining whether anyother MAC address is associated with the first look-up table addresssuch that only one MAC address is associated with any given look-uptable address.
 16. The method of claim 12 wherein determining whetherthe first look-up table address is occupied comprises determiningwhether fewer than n MAC addresses associated with the first look-uptable address such that the number of MAC addresses associated with thefirst look-up table address is less than n, wherein n is an integergreater than one.
 17. The method of claim 12 wherein generating a secondlook-up table address comprises modulating the string with a Walsh code.18. The method of claim 12 wherein generating a first look-up tableaddress comprises hashing the MAC address with a Cyclic Redundancy Code(CRC).
 19. The method of claim 12 and further comprising, if the firstlook-up table address is not occupied, associating the MAC address withthe first look-up table address.
 20. The method of claim 19 wherein thestep of generating a second look-up table address is not performed ifthe first look-up table address is not occupied.
 21. The method ofextracting information related to a media access control (MAC) address,the method comprising: receiving a MAC address; generating a firstlook-up table address by applying an algorithm to the MAC address;determining whether the first look-up table address is associated withthe MAC address; if the first look-up table address is associated withthe MAC address, extracting information related to the MAC address froma look-up table using the first look-up table address; if the firstlook-up table address is not associated with the MAC address, generatinga second look-up table address by forming a string having the samenumber of bits as the MAC address and applying the algorithm to thestring; determining whether the second look-up table address isassociated with the MAC address; and if the second look-up table addressis associated with the MAC address, extracting information related tothe MAC address from the look-up table using the second look-up tableaddress.
 22. The method of claim 21 wherein determining whether thefirst look-up table address is associated with the MAC address comprisesexamining correspondence data at the first look-up table address in thelook-up table.